package com.gitee.wsl.mathematics.coordinate.ext

import com.gitee.wsl.mathematics.coordinate.d3.MutableCoordinate3
import com.gitee.wsl.mathematics.vector.vec3.Vector3



// dest += (a - c) cross (b - c)
fun <T:Number> MutableCoordinate3<T, *>.crossCentered(a: Vector3<T, *>, b: Vector3<T, *>, c: Vector3<T, *>) {
    val ax = a.x - c.x
    val ay = a.y - c.y
    val az = a.z - c.z
    val bx = b.x - c.x
    val by = b.y - c.y
    val bz = b.z - c.z
    x += ay * bz - az * by
    y += -ax * bz + az * bx
    z += ax * by - ay * bx
}
